import Vue from 'vue'
import App from './App.vue'
import router from '@/router'; // 引入路由配置
import Cookies from 'js-cookie'
import Notifications from 'vue-notification';
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale';
import ja from "element-plus/es/locale/lang/ja";

locale.use(ja);
Vue.use(ElementUI)
Vue.use(Notifications);
Vue.config.productionTip = false;



//完成路由守卫
router.beforeEach((to, from, next) => {
  // 判断是否登录
  if (to.path === '/login') {
    next();
  } else {
    if (Cookies.get('token')) {
      next();
    } else {
      next('/login');
    }
  }
})

new Vue({
  router,
  render: h => h(App),
}).$mount('#app')
